﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ep_question_type_edit.aspx.cs"
    Inherits="ePioneer_ep_question_type_edit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../css/style.css" rel="stylesheet" type="text/css" />
    <script src="Javascript/jquery-1.4.4.min.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table class="query_form_table">
            <tr>
                <th>
                    所属类别
                </th>
                <td>
                    <asp:DropDownList ID="ddlepType" runat="server" Width="200px">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <th>
                    类别名称
                </th>
                <td>
                    <asp:TextBox ID="txt_brief" runat="server" Width="200px" /><asp:RequiredFieldValidator
                        ID="RequiredFieldValidator1" runat="server" ErrorMessage="类别名称不能为空" ControlToValidate="txt_brief"
                        ForeColor="Red"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:Button ID="BtnModify" runat="server" Text="保存" OnClick="BtnModify_Click" />
                    &nbsp;
                    <input type="button" value="返回" onclick="location.href='ep_question_type.aspx'" />
                </td>
            </tr>
        </table>
    </div>
    <asp:HiddenField ID="HiddenFieldType" runat="server" />
    <script type="text/javascript">
        $(document).ready(function () {
            $('#BtnModify').click(function () {
                var txt_brief = $("#txt_brief").val();
                if (txt_brief == "") {
                    $("#txt_brief").val("");
                    $("#txt_brief").focus();
                    return false;
                }
                else {
                    if (getByteLen(txt_brief) > 40) {
                        alert("类别名称不能超过10个中文字符");
                        $("#txt_brief").focus();
                        return false;
                    }
                }                
            });
        });
        function getByteLen(str) {
            var l = str.length;
            var n = l;
            for (var i = 0; i < l; i++) {
                if (str.charCodeAt(i) < 0 || str.charCodeAt(i) > 255) {
                    n++;
                }
            }
            return n;
        } 
    </script>
    </form>
</body>
</html>
